package com.sophossystems.client.asmon.dto;


import java.io.Serializable;


public class RoleDTO implements Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = -6638684158226745682L;

	/** 
	 * This attribute maps to the column idRole in the Role table.
	 */
	protected int idRole;

	/** 
	 * This attribute maps to the column Name in the Role table.
	 */
	protected String name;

	/** 
	 * This attribute maps to the column idRoleSuperior in the Role table.
	 */
	protected int idRoleSuperior;

	/** 
	 * This attribute represents whether the primitive attribute idRoleSuperior is null.
	 */
	protected boolean idRoleSuperiorNull = true;

	/**
	 * Method 'Role'
	 * 
	 */
	public RoleDTO()
	{
	}

	/**
	 * Method 'getIdRole'
	 * 
	 * @return int
	 */
	public int getIdRole()
	{
		return idRole;
	}

	/**
	 * Method 'setIdRole'
	 * 
	 * @param idRole
	 */
	public void setIdRole(int idRole)
	{
		this.idRole = idRole;
	}

	/**
	 * Method 'getName'
	 * 
	 * @return String
	 */
	public String getName()
	{
		return name;
	}

	/**
	 * Method 'setName'
	 * 
	 * @param name
	 */
	public void setName(String name)
	{
		this.name = name;
	}

	/**
	 * Method 'getIdRoleSuperior'
	 * 
	 * @return int
	 */
	public int getIdRoleSuperior()
	{
		return idRoleSuperior;
	}

	/**
	 * Method 'setIdRoleSuperior'
	 * 
	 * @param idRoleSuperior
	 */
	public void setIdRoleSuperior(int idRoleSuperior)
	{
		this.idRoleSuperior = idRoleSuperior;
		this.idRoleSuperiorNull = false;
	}

	/**
	 * Method 'setIdRoleSuperiorNull'
	 * 
	 * @param value
	 */
	public void setIdRoleSuperiorNull(boolean value)
	{
		this.idRoleSuperiorNull = value;
	}

	/**
	 * Method 'isIdRoleSuperiorNull'
	 * 
	 * @return boolean
	 */
	public boolean isIdRoleSuperiorNull()
	{
		return idRoleSuperiorNull;
	}

	/**
	 * Method 'equals'
	 * 
	 * @param _other
	 * @return boolean
	 */
	@Override
	public boolean equals(Object _other)
	{
		if (_other == null) {
			return false;
		}
		
		if (_other == this) {
			return true;
		}
		
		if (!(_other instanceof RoleDTO)) {
			return false;
		}
		
		final RoleDTO _cast = (RoleDTO) _other;
		if (idRole != _cast.idRole) {
			return false;
		}
		
		if (name == null ? _cast.name != name : !name.equals( _cast.name )) {
			return false;
		}
		
		if (idRoleSuperior != _cast.idRoleSuperior) {
			return false;
		}
		
		if (idRoleSuperiorNull != _cast.idRoleSuperiorNull) {
			return false;
		}
		
		return true;
	}

	/**
	 * Method 'hashCode'
	 * 
	 * @return int
	 */
	@Override
	public int hashCode()
	{
		int _hashCode = 0;
		_hashCode = 29 * _hashCode + idRole;
		if (name != null) {
			_hashCode = 29 * _hashCode + name.hashCode();
		}
		
		_hashCode = 29 * _hashCode + idRoleSuperior;
		_hashCode = 29 * _hashCode + (idRoleSuperiorNull ? 1 : 0);
		return _hashCode;
	}

	/**
	 * Method 'createPk'
	 * 
	 * @return RolePk
	 */
	public RolePkDTO createPk()
	{
		return new RolePkDTO(idRole);
	}

	/**
	 * Method 'toString'
	 * 
	 * @return String
	 */
	@Override
	public String toString()
	{
		StringBuffer ret = new StringBuffer();
		ret.append( "com.sophossystems.client.asmon.dto.Role: " );
		ret.append( "idRole=" + idRole );
		ret.append( ", name=" + name );
		ret.append( ", idRoleSuperior=" + idRoleSuperior );
		return ret.toString();
	}

}
